package org.liuqm.proxy.cglibproxy;


import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * CGlib代理类
 */
public class CgLibProxy implements MethodInterceptor {



    @Override
    public Object intercept(Object o, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {

        System.out.println("进入cglib动态代理");
        //调用代理类的父类的方法
        Object result = methodProxy.invokeSuper(o, args);
        System.out.println("调用了被代理类方法");
        return result;
    }
}
